# core/logging_config.py
import logging
import sys

LOG_FORMAT = "[%(asctime)s] [%(levelname)s] %(message)s"

def setup_logging():
    logging.basicConfig(
        level=logging.INFO,
        format=LOG_FORMAT,
        handlers=[
            logging.StreamHandler(sys.stdout),  # 控制台
            logging.FileHandler("app.log", encoding="utf-8"),  # 文件
        ],
    )
    return logging.getLogger("app")

logger = setup_logging()
